
# factorial
def fuc1(num: int):
    if num <= 0:
        print('{} is less than or equal to 0.'.format(num))
        return -1
    if num == 1:
        return 1
    else:
        return num * fuc1(num - 1)


# prime
def fuc2(num: int):
    flag = 1
    for i in range(2, int(num ** 0.5) + 1):
        if num % i == 0:
            flag = 0
            break
    if flag == 0:
        print('{} is not a prime!'.format(num))
        return False
    else:
        print('{} is a prime!'.format(num))
        return True


# plaindrome
def fuc3(string: str):
    lenth = len(string)
    first = list(string[0:int(lenth / 2) + 1 if lenth % 2 != 0
                                else int(lenth / 2)])

    second = list(string[int(lenth / 2):])
    #print(first)
    second.reverse()
    #print(second)
    if first == second:
        print('{} is plaindrome!'.format(string))
    else:
        print('{} is not plaindrome!'.format(string))


def main():

    print("*" * 10, "fuction1 is coming!", "*" * 10)
    for i in (-1, 2, 3, 5, 6, 10):
        print('The factorial of {} is {}.'.format(i, fuc1(i) if fuc1(i) != -1
                                                            else None))

    print("*" * 10, "fuction2 is coming!", "*" * 10)
    for i in (1, 3, 5, 9, 10, 15, 17):
        result = fuc2(i)

    print("*" * 10, "fuction3 is coming!", "*" * 10)
    for i in ("123321", "abcba", "abcde", "acvdvca", "abcdcb"):
        fuc3(i)


if __name__ == '__main__':
    main()
# 可以多试试集中解题的方法